const { Setduration } = require("./mw.js");
const serve = require("koa-static");
const bodyParser = require("koa-bodyparser");
const { router } = require("./routers");
const koa = require("koa");
const { jwt } = require("./jwt.js");
const path = require("path");

const app = new koa();
app.use(Setduration);
app.use(bodyParser());
app.use(serve(path.join(__dirname + "/public")));

// app.use((ctx, next) => {
//   console.log(ctx.url);
//   next();
// });

// app.use(jwt);

// 应用路由
app.use(router.routes()).use(router.allowedMethods());

app.listen(2500, () => {
  console.log("开启监听成功...");
});
